home *** CD-ROM | disk | FTP | other *** search
- #include <mio.h>
- #include <mgr.h>
-
- #define SPEED 1
-
- RECT SampleBox (20,20,300,160);
-
- /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
- int main ()
- /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
- {
- MMob * Flyer;
- MImage FlyerImage (50,50);
- int n;
- int dx = SPEED, dy = SPEED;
- MPal myPal;
-
- initgraph();
- myPal.Update();
- myPal.FadeOut();
-
- for (n = 25; n > 0; -- n)
- {
- setcolor (n + 30);
- circle (25,25,n);
- }
- FlyerImage.Get (0,0);
-
- setfillstyle (SOLID_FILL, 76); // Clear the screen
- bar (gr.vp.left, gr.vp.top, gr.vp.right, gr.vp.bottom);
- setviewport (SampleBox);
- setfillstyle (SOLID_FILL, 80); // Clear viewport
- bar (gr.vp.left, gr.vp.top, gr.vp.right, gr.vp.bottom);
-
- Flyer = new MMob (100, 100, &FlyerImage);
- Flyer->SetPut (SEETH_PUT);
- myPal.FadeIn();
-
- keyb.KeyFlush();
-
- while (!keyb.KeyPress())
- {
- Flyer->MoveTo (Flyer->x() + dx, Flyer->y() + dy);
- if ((Flyer->x() <= 0) || (Flyer->x() >= MAXX - FlyerImage.GetLength()))
- dx = -dx;
- if ((Flyer->y() <= 0) || (Flyer->y() >= MAXY - FlyerImage.GetWidth()))
- dy = -dy;
- }
- delete Flyer;
- myPal.FadeOut();
- closegraph();
- return (0);
- }